package app.post.controller;

import app.post.mapper.RemarkMapper;
import app.post.model.Remark;
import app.post.serviceImpl.RemarkServiceImpl;
import app.sys.controller.BaseRestController;
import app.sys.model.ResponseObj;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.yedaxia.apidocs.ApiDoc;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 评论表 前端控制器
 * </p>
 *
 * @author fyy
 * @since 2025-08-11
 */
@ApiDoc
@RestController
@RequestMapping("/post/remark")
public class RemarkController extends BaseRestController<RemarkServiceImpl, RemarkMapper,
        Remark, Long> {

    @Override
    protected QueryWrapper queryWrapper(QueryWrapper<Remark> wrapper) {
        wrapper.orderByDesc("create_time");
        return super.queryWrapper(wrapper);
    }
    /**
     * 返回列表
     *
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @Override
    public ResponseObj<List<Remark>> list(Remark model) throws Exception {
        return super.list(model);
    }

    /**
     * 分页查询
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    @Override
    public ResponseObj<Page<Remark>> listPage(Page<Remark> page, Remark model) throws Exception {
        return super.listPage(page, model);
    }
    /**
     * 查询详情
     * @param id
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @Override
    public ResponseObj<Remark> detail(Long id) throws Exception {
        return super.detail(id);
    }
    /**
     * 新增
     *
     * @param object
     * @return
     */
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    @Override
    public ResponseObj<Boolean> insert(Remark object) throws Exception {
        return super.insert(object);
    }

    /**
     * 修改
     * @param object
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @Override
    public ResponseObj<Boolean> update(Remark object) throws Exception {
        return super.update(object);
    }
}

